package com.petmall.controller;

import com.petmall.entity.Admin;
import com.petmall.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by pig2guang on 2017/3/26.
 */
@Controller
public class ViewController {

    User user = new User();

    @RequestMapping(value = "/index")
    public String index() { return "index"; }

    @RequestMapping(value = "/404-page")
    public String errorpage(){
        return "404-page";
    }

    @RequestMapping(value = "/login")
    public String login(Model model){
        model.addAttribute("admin", new Admin());
        model.addAttribute("user", new User());
        return "login";
    }

    @RequestMapping(value = "/checkout")
    public String checkout(){
        return "checkout";
    }

    //尝试做了一个加密登录注册功能
    @RequestMapping(value = "/md5-login")
    public String login_safe_md5(){
        return "md5-login";
    }


//    @RequestMapping(value = "/my-account")
//    public ModelAndView account(){
//        return new ModelAndView("my-account").addObject(user);
//    }


//    @RequestMapping(value = "/my-account")
//    public ModelAndView account(){
//        return new ModelAndView("my-account").addObject(user);
//    }
//
//    @RequestMapping(value = "/my-account")
//    public ModelAndView account(){
//        return new ModelAndView("my-account").addObject(user);
//    }

}
